#pragma once
#ifdef WIN32
#include <Windows.h>
#include <process.h>
#else
#include <pthread.h>
#endif

/*
#ifdef WIN32
typedef unsigned int(__stdcall *thread_func)(void*);
#else
typedef void*(*thread_func)(void*);
#endif
*/

class thread
{
public:
	thread();
	virtual ~thread();

	bool create();
	bool createListen();

	void wait();
	void closeListen();

	virtual void run();
	virtual void runListen();


#ifdef WIN32
	static unsigned __stdcall thread_func(void* arg);
	static unsigned __stdcall thread_Listen(void* arg);
#else
	static void* thread_func(void* arg);
	static void* thread_Listen(void* arg);
#endif

protected:
#ifdef WIN32
	HANDLE m_handle;
	HANDLE n_handle;
#else
	pthread_t m_thread_t;
	pthread_t n_thread_t;
#endif
};


